<script type="text/javascript">
$(document).ready(function(){
	$("#frmSearch").submit(function(){
		var keyword = $("#keyword").attr("value");
		if( keyword == '' || keyword == "Tìm sản phẩm..."){
			alert("Bạn cần nhập từ khóa tìm kiếm!");
			return false;
		}
	});
});
</script>
<div id="main_content">
        	<?php try{?>
			<div id="view_post_box">
            	<div id="title_view_post_box"><?php echo $this->category->name;?></div>
                <div id="content_post_box">
					<?php
					if(isset($this->arrPosts) && count($this->arrPosts) > 0){
						foreach($this->arrPosts as $post){
					?>
					<div class="post-item">
						<img alt="Thiết bị văn phòng Cường Phú" src="<?php echo $post->feature_image?>" width="150px"/>
						<div>
							<a href="<?php echo $this->url(array("slug" => $post->slug), "post");?>"><?php echo $post->title;?></a>
							<p>
								<?php echo $post->summary;?>
							</p>
							<a class="readmore" href="<?php echo $this->url(array("slug" => $post->slug), "post");?>">
								Chi tiết &raquo;
							</a>
						</div>
					</div>
					<?php	
					} 
					?>

                </div>
                
				
				<?php
            	echo $this->paginationControl($this->arrPosts,
                                    'Sliding',
                                    'post/pagination.phtml', array('category' => $this->category)); 
                }else{?>
                <div id="error">Không có bài viết nào phù hợp</div>
                <?php }?>
                <div style="clear: both;"></div>
            </div>
           
</div><!-- end main_content block -->
        <div id="right">
        	<div id="search_box">
        		<form id="frmSearch" action="<?php echo $this->url(array(), "search");?>" method="get">
        			<input type="text" onclick="value='';"  id="keyword" name="keyword" value="Tìm sản phẩm..."/>
                	<input type="submit" id="submit_button" value="Tìm kiếm" />
        		</form>
            	
            </div><!-- end search_block-->
            <div id="cart_box">
            	<div id="title_cart"><a href="<?php echo $this->url(array(),"cart");?>">Giỏ hàng của bạn</a></div>
                <div class="cart_info">
                	<span class="left_info">Số sản phẩm:&nbsp; </span>
                    <span class="right_info"><?php echo $this->totalCartProduct;?></span>
                </div>
                <div class="cart_info">
                	<span class="left_info">Tổng tiền:&nbsp;</span>
                    <span class="right_info"><?php echo number_format($this->totalCartPrice);?> VND</span>
                </div>
            </div> <!-- end cart_block -->
            <?php
            //lấy dữ liệu để điền vào 2 box hỗ trợ trực tuyến
            $arrSalers = array();
            $arrTechnicians = array(); 
            foreach ($this->supporters as $supporter){
            	if($supporter->type == 0){
            		$arrSalers[] = $supporter;
            	}else{
            		$arrTechnicians[] = $supporter;
            	}
            }
            
                  
            ?>
            <div class="right_box">
            	<div class="title_box">
                	<div class="text_title_box">Bán hàng trực tuyến</div>
                    <div class="phone_title_box">(04) 35 68 36 99</div>
                </div>
                <?php $count_business =count($arrSalers);
               	if($count_business>0){
               	for( $i=0;$i<$count_business;$i++){?>
               	 <div class="supporter">
                	<div class="info_supporter">
                    	<div class="name_supporter">
                        	<a href="ymsgr:SendIM?<?php echo $arrSalers[$i]->yahoo_account;?>"  title="Contact to supporter!">
         						<?php echo $arrSalers[$i]->name;?>
                            </a>
                            </div>
                       	<div class="phone_supporter"><?php echo $arrSalers[$i]->phone;?></div>
                        <div class="email_supporter"><?php echo $arrSalers[$i]->email;?></div>
                        
                    </div>
                    <a href="ymsgr:SendIM?<?php echo $arrSalers[$i]->yahoo_account;?>"  title="Contact to supporter!">
                            <img  alt="" src="http://opi.yahoo.com/online?u=<?php echo $arrSalers[$i]->yahoo_account;?>&m=g&t=1" border="0"/>
                        </a>
                    <?php if($i+2 <= $count_business){?><div class="line"></div><?php } ?>
                </div>
               <?php }
               	 } ?>
                
               
            </div><!-- end right_box-->           
            <div class="right_box">
            	<div class="title_box">
                	<div class="text_title_box">Hỗ trợ kỹ thuật</div>
                    <div class="phone_title_box">(04) 66 84 87 86</div>
                </div>
                <?php $count_technical =count($arrTechnicians);
               	if($count_technical>0){
               	for( $i=0;$i<$count_technical;$i++){?>
               	 <div class="supporter">
                	<div class="info_supporter">
                    	<div class="name_supporter">
                        	<a href="ymsgr:SendIM?<?php echo $arrTechnicians[$i]->yahoo_account;?>"  title="Contact to supporter!">
         						<?php echo $arrTechnicians[$i]->name;?>
                            </a>
                            </div>
                        <div class="phone_supporter"><?php echo $arrTechnicians[$i]->phone;?></div>
                        <div class="email_supporter"><?php echo $arrTechnicians[$i]->email;?></div>
                        
                    </div>
                    <a href="ymsgr:SendIM?<?php echo $arrTechnicians[$i]->yahoo_account;?>"  title="Contact to supporter!">
                            <img  alt="" src="http://opi.yahoo.com/online?u=<?php echo $arrTechnicians[$i]->yahoo_account;?>&m=g&t=1" border="0"/>
                        </a>
                    <?php if($i+2 <= $count_technical){?><div class="line"></div><?php } ?>
                </div>
               <?php }
               	 } ?>
            </div><!-- end right_box-->
            <?php
            echo $this->partial("include/tags.phtml", array("tags" => $this->tags));
            ?>
                 <?php }catch (Exception $ex){echo $ex->getMessage();}?>     
        </div><!-- end right block -->
        <div id="clear"></div>